package com.yilu.driver.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.is.common.utils.SPUtils;
import com.is.ui.eventbus.EventCenter;
import com.is.ui.netstatus.NetUtils;
import com.is.ui.widget.CountDownView;
import com.yilu.driver.R;
import com.yilu.driver.base.BaseActivity;

import butterknife.Bind;


public class SplashActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.countDownView)
    CountDownView countDownView;
    private Class startClass;

    @Override
    protected void getBundleExtras(Bundle extras) {

    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.activity_splash;
    }

    @Override
    protected void onEventComming(EventCenter eventCenter) {

    }

    @Override
    public void showLoading(String msg) {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showError(String msg) {

    }

    @Override
    public void showException(String msg) {

    }

    @Override
    public void showToast(String msg) {

    }

    @Override
    protected void onNetworkConnected(NetUtils.NetType type) {

    }

    @Override
    protected void onNetworkDisConnected() {

    }

    @Override
    protected void initViewsAndEvents() {
        Boolean isLogin = (Boolean) SPUtils.get(mContext, "isLogin", false);
        if (isLogin) {
            startClass = MainActivity.class;
        } else {
            startClass = LoginActivity.class;
        }
        countDownView.setCountDownTimerListener(new CountDownView.CountDownTimerListener() {
            @Override
            public void onStartCount() {

            }

            @Override
            public void onFinishCount() {
                Intent intent = new Intent(SplashActivity.this, startClass);
                startActivity(intent);
                finish();
            }
        });
        countDownView.setOnClickListener(this);
        countDownView.start();
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }

    @Override
    protected boolean toggleOverridePendingTransition() {
        return false;
    }

    @Override
    protected TransitionMode getOverridePendingTransitionMode() {
        return null;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    protected boolean isApplySystemBarColor() {
        return false;
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent(SplashActivity.this, startClass);
        startActivity(intent);
        finish();
    }
}
